import http from './http'
// https://api-hmugo-web.itheima.net/api/public/v1/goods/search
export const searchApi=(query)=>{
    return http({
        url:'https://api-hmugo-web.itheima.net/api/public/v1/goods/search',
        method:'GET',
        data:{
            query
        }
    })
}
// https://api-hmugo-web.itheima.net/api/public/v1/goods/detail
export const detailApi=(goods_id)=>{
    return http({
        url:'https://api-hmugo-web.itheima.net/api/public/v1/goods/detail',
        method:'GET',
        params:{
            goods_id
        }
    })
}
// /api/order/create
export const createApi=(data)=>{
    return http({
        url:'http://localhost:12345/api/order/create',
        method:'POST',
        data:{
            ...data
        }
    })
}
// /api/order/getOrder/ak0jbjczik
export const getOrderApi=(orderId)=>{
    return http({
        url:'http://localhost:12345/api/order/getOrder/'+orderId,
        method:'GET',
       
    })
}
// /api/order/pay
export const payApi=(data)=>{
    return http({
        url:'http://localhost:12345/api/order/pay',
        method:'POST',
        data:{
            ...data
        }
       
    })
}
// /api/order/getOrderList/zhangsan
export const getOrderList=(username)=>{
    return http({
        url:'http://localhost:12345/api/order/getOrderList/'+username,
        method:'GET'
    })
}
export const registerApi=(username,password)=>{
    return http({
        url:'http://localhost:12345/api/user/register',
        method:'POST',
        data:{
            username,
            password
        }

    })
}
export const loginApi=(username,password)=>{
    return http({
        url:'http://localhost:12345/api/user/login',
        method:'POST',
        data:{
            username,password
        }

    })
}
// https://api-hmugo-web.itheima.net/api/public/v1/categories
export const categoriesApi=()=>{
    return http({
        url:'https://api-hmugo-web.itheima.net/api/public/v1/categories',
        method:'GET',
    })
}
// /api/order/delorder/ak0jbjczik
export const delorderApi=(orderId)=>{
    return http({
        url:'http://localhost:12345/api/order/delorder'+orderId,
        method:'GET',
    })
}



